package model.bo;


import java.util.List;

public class GoodsBO {
    //name, typeId, img, desc, specList(specName, stockNUm, unitPrice)
    private Integer id;
    private String name;
    private Integer typeId;
    private String img;
    private String desc;
    private List<SpecBO> specList;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public List<SpecBO> getSpecList() {
        return specList;
    }

    public void setSpecList(List<SpecBO> specList) {
        this.specList = specList;
    }

    @Override
    public String toString() {
        return "GoodsBO{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", typeId=" + typeId +
                ", img='" + img + '\'' +
                ", desc='" + desc + '\'' +
                ", specList=" + specList +
                '}';
    }

    public String getString() {
        return "AdminAddGoodsBO{" +
                "name='" + name + '\'' +
                ", typeId=" + typeId +
                ", img='" + img + '\'' +
                ", desc='" + desc + '\'' +
                ", specs=" + listToString(specList) +
                '}';
    }

    private String listToString(List<?> list) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (Object e : list) {
            sb.append(e.toString()).append(",");
        }
        sb.replace(sb.length() - 1, 1, "]");
        return sb.toString();
    }
}
